#include "SimpleDockAnimator.h"

//=============================================================================
SimpleDockAnimator::SimpleDockAnimator (Component* mainComponent_) : mainComponent (mainComponent_),
																	  animation (0),
																	  moving (false)
{
}

SimpleDockAnimator::~SimpleDockAnimator ()
{
}

void SimpleDockAnimator::showWindow()
{
	animation = new CompAnims::Move (	mainComponent,
										mainComponent->getX(),
										mainComponent->getY(),
										mainComponent->getX(), 0, 200);
	animation->setLooping (false, false, false);

	moving = true;

	start (animation);
}

void SimpleDockAnimator::hideWindow()
{
	animation = new CompAnims::Move (	mainComponent,
										mainComponent->getX(),
										mainComponent->getY(),
										mainComponent->getX(), 2 - mainComponent->getHeight(), 200);
	animation->setLooping (false, false, false);

	moving = true;

	start (animation);
}

bool SimpleDockAnimator::isMoving()
{
	return moving;
}

void SimpleDockAnimator::frameFinished (void* target)
{
	moving = false;
	Component* t = (Component*) target;
	if (t) t->repaint ();
}